package com.yvon.boot.common.result;


public class GlobalException extends RuntimeException {
    private static final long serialVersionUID = -7996556093413097167L;
    private final Integer code;



    public GlobalException(Integer code) {
        super();
        this.code = code;
    }

    public Integer getCode() {
        return this.code;
    }

    public GlobalException(Throwable cause) {
        super(ResultCode.GLOBAL_EXCEPTION.getMessage(), cause);
        this.code = ResultCode.GLOBAL_EXCEPTION.getCode();
    }

    public GlobalException(Throwable cause, String msg) {
        super(msg, cause);
        this.code = ResultCode.GLOBAL_EXCEPTION.getCode();
    }

    public GlobalException(String msg) {
        super(msg);
        this.code = ResultCode.GLOBAL_EXCEPTION.getCode();
    }

    public GlobalException(Integer code, String msg) {
        super(msg);
        this.code = code;
    }

    public GlobalException(ResultCode code) {
        super(code.getMessage());
        this.code = code.getCode();
    }

    public GlobalException(ResultCode code, String msg) {
        super(msg);
        this.code = code.getCode();
    }

}
